package com.xu.demo.builderPattern;

/**
 * 建造者模式测试类
 */
public class BuilderPattern {

    public static void main(String[] args) {

        // 使用建造者构建订单
        Order order = new OrderBuilder()
                .setOrderNumber("123456")
                .addOrderItem("汉堡", 2)
                .addOrderItem("可乐", 1)
                .setShippingAddress("天府大道001号")
                .setPaymentInfo("花呗")
                .build();

        // 打印订单信息
        System.out.println("订单编号: " + order.getOrderNumber());
        System.out.println("送货地址: " + order.getShippingAddress());
        System.out.println("支付方式: " + order.getPaymentInfo());
        System.out.println("订单商品列表: " + order.getOrderItems());

    }
}
